package cn.bossx.basic.interceprot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")//拦截所有请求
                .excludePathPatterns(  //放行资源
                        "/login/**",
                        "/user/phone/register",
                        "/shop/settlement",
                        "/fastDfs/**",
                        "/verifycode/**",
                        "/notify", // 支付宝成功支付后的异步回调地址
                        "/swagger-resources/**","/webjars/**","/v2/**","/swagger-ui.html/**" //swagger请求

                );

    }
}